Convert GailScale to GtkScaleAccessible
authorMatthias Clasen <mclasen@redhat.com>
Mon, 27 Jun 2011 01:14:08 +0000 (21:14 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 5 Jul 2011 20:08:10 +0000 (16:08 -0400)
gtk/a11y/Makefile.am
gtk/a11y/gail.c
gtk/a11y/gailscale.c [deleted file]
gtk/a11y/gailscale.h [deleted file]
gtk/a11y/gtkscaleaccessible.c [new file with mode: 0644]
gtk/a11y/gtkscaleaccessible.h [new file with mode: 0644]
gtk/gtkscale.c

index daad6716db49abc96261476e45856572f2a69041..ca2181d15c24dd98c342248bea8d0ee5e990e2f2 100644 (file)
@@ -38,7 +38,7 @@ gail_c_sources =                      \
        gailradiosubmenuitem.c          \
        gailrange.c                     \
        gailrenderercell.c              \
-       gailscale.c                     \
+       gtkscaleaccessible.c            \
        gailscalebutton.c               \
        gailscrollbar.c                 \
        gailscrolledwindow.c            \
@@ -93,7 +93,7 @@ gail_private_h_sources =              \
        gailradiosubmenuitem.h          \
        gailrange.h                     \
        gailrenderercell.h              \
-       gailscale.h                     \
+       gtkscaleaccessible.h            \
        gailscalebutton.h               \
        gailscrollbar.h                 \
        gailscrolledwindow.h            \
index 4951541c809faef5bd598d1c234c42c84598c4d9..b9e25f6ce94cde160f78cd1f766cc3522c0499de 100644 (file)
@@ -49,7 +49,6 @@
 #include "gailradiomenuitem.h"
 #include "gailrenderercell.h"
 #include "gailrange.h"
-#include "gailscale.h"
 #include "gailscalebutton.h"
 #include "gailscrollbar.h"
 #include "gailscrolledwindow.h"
@@ -121,7 +120,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU_SHELL, GailMenuShell, gail_menu_shell, GT
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU, GailMenu, gail_menu, GTK_TYPE_MENU)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WINDOW, GailWindow, gail_window, GTK_TYPE_BIN)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RANGE, GailRange, gail_range, GTK_TYPE_RANGE)
-GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCALE, GailScale, gail_scale, GTK_TYPE_SCALE)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCALE_BUTTON, GailScaleButton, gail_scale_button, GTK_TYPE_SCALE_BUTTON)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_STATUSBAR, GailStatusbar, gail_statusbar, GTK_TYPE_STATUSBAR)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_NOTEBOOK, GailNotebook, gail_notebook, GTK_TYPE_NOTEBOOK)
@@ -895,7 +893,6 @@ gail_accessibility_module_init (void)
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU, gail_menu);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_WINDOW, gail_window);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RANGE, gail_range);
-  GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCALE, gail_scale);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCALE_BUTTON, gail_scale_button);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_STATUSBAR, gail_statusbar);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook);
diff --git a/gtk/a11y/gailscale.c b/gtk/a11y/gailscale.c
deleted file mode 100644 (file)
index 1fa656b..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2004 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include "gailscale.h"
-
-static const char * gail_scale_get_description   (AtkObject     *object);
-
-G_DEFINE_TYPE (GailScale, gail_scale, GAIL_TYPE_RANGE)
-
-static void     
-gail_scale_class_init (GailScaleClass *klass)
-{
-  AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
-  class->get_description = gail_scale_get_description;
-}
-
-static void
-gail_scale_init (GailScale      *scale)
-{
-}
-
-static const char *
-gail_scale_get_description (AtkObject *object)
-{
-  GtkWidget *widget;
-  PangoLayout *layout;
-
-  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object));
-  if (widget == NULL)
-    /* State is defunct */
-    return NULL;
-
-  layout = gtk_scale_get_layout (GTK_SCALE (widget));
-  if (layout)
-    return pango_layout_get_text (layout);
-
-  return ATK_OBJECT_CLASS (gail_scale_parent_class)->get_description (object);
-}
diff --git a/gtk/a11y/gailscale.h b/gtk/a11y/gailscale.h
deleted file mode 100644 (file)
index d0c843f..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2004 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GAIL_SCALE_H__
-#define __GAIL_SCALE_H__
-
-#include "gailrange.h"
-#include "gailtextutil.h"
-
-G_BEGIN_DECLS
-
-#define GAIL_TYPE_SCALE                         (gail_scale_get_type ())
-#define GAIL_SCALE(obj)                         (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_SCALE, GailScale))
-#define GAIL_SCALE_CLASS(klass)                        (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_SCALE, GailScaleClass))
-#define GAIL_IS_SCALE(obj)                     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_SCALE))
-#define GAIL_IS_SCALE_CLASS(klass)             (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_SCALE))
-#define GAIL_SCALE_GET_CLASS(obj)              (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_SCALE, GailScaleClass))
-
-typedef struct _GailScale              GailScale;
-typedef struct _GailScaleClass         GailScaleClass;
-
-struct _GailScale
-{
-  GailRange parent;
-
-  GailTextUtil *textutil;
-};
-
-GType gail_scale_get_type (void);
-
-struct _GailScaleClass
-{
-  GailRangeClass parent_class;
-};
-
-G_END_DECLS
-
-#endif /* __GAIL_SCALE_H__ */
diff --git a/gtk/a11y/gtkscaleaccessible.c b/gtk/a11y/gtkscaleaccessible.c
new file mode 100644 (file)
index 0000000..7e3de32
--- /dev/null
@@ -0,0 +1,55 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2004 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include "gtkscaleaccessible.h"
+
+G_DEFINE_TYPE (GtkScaleAccessible, gtk_scale_accessible, GAIL_TYPE_RANGE)
+
+static const gchar *
+gtk_scale_accessible_get_description (AtkObject *object)
+{
+  GtkWidget *widget;
+  PangoLayout *layout;
+
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object));
+  if (widget == NULL)
+    return NULL;
+
+  layout = gtk_scale_get_layout (GTK_SCALE (widget));
+  if (layout)
+    return pango_layout_get_text (layout);
+
+  return ATK_OBJECT_CLASS (gtk_scale_accessible_parent_class)->get_description (object);
+}
+
+static void
+gtk_scale_accessible_class_init (GtkScaleAccessibleClass *klass)
+{
+  AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+  class->get_description = gtk_scale_accessible_get_description;
+}
+
+static void
+gtk_scale_accessible_init (GtkScaleAccessible *scale)
+{
+}
diff --git a/gtk/a11y/gtkscaleaccessible.h b/gtk/a11y/gtkscaleaccessible.h
new file mode 100644 (file)
index 0000000..648130b
--- /dev/null
@@ -0,0 +1,52 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2004 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_SCALE_ACCESSIBLE_H__
+#define __GTK_SCALE_ACCESSIBLE_H__
+
+#include "gailrange.h"
+#include "gailtextutil.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_SCALE_ACCESSIBLE                         (gtk_scale_accessible_get_type ())
+#define GTK_SCALE_ACCESSIBLE(obj)                         (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessible))
+#define GTK_SCALE_ACCESSIBLE_CLASS(klass)                       (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessibleClass))
+#define GTK_IS_SCALE_ACCESSIBLE(obj)                      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCALE_ACCESSIBLE))
+#define GTK_IS_SCALE_ACCESSIBLE_CLASS(klass)              (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCALE_ACCESSIBLE))
+#define GTK_SCALE_ACCESSIBLE_GET_CLASS(obj)             (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessibleClass))
+
+typedef struct _GtkScaleAccessible      GtkScaleAccessible;
+typedef struct _GtkScaleAccessibleClass GtkScaleAccessibleClass;
+
+struct _GtkScaleAccessible
+{
+  GailRange parent;
+};
+
+struct _GtkScaleAccessibleClass
+{
+  GailRangeClass parent_class;
+};
+
+GType gtk_scale_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_SCALE_ACCESSIBLE_H__ */
index 042722e2a06af8dee5a187387ca21774c576a1ae..979f45f66be93929e1de0b81b45f59484f1a4a8e 100644 (file)
@@ -42,6 +42,8 @@
 #include "gtkbuildable.h"
 #include "gtkbuilderprivate.h"
 
+#include "a11y/gtkscaleaccessible.h"
+
 
 /**
  * SECTION:gtkscale
@@ -410,6 +412,8 @@ gtk_scale_class_init (GtkScaleClass *class)
                       GTK_SCROLL_END);
 
   g_type_class_add_private (gobject_class, sizeof (GtkScalePrivate));
+
+  gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCALE_ACCESSIBLE);
 }
 
 static void